package com.hospital.tts.adapter;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hospital.tts.R;
import com.hospital.tts.dataBean.InfoBean;
import com.hospital.tts.dataBean.UserBean;

import java.util.List;

public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder>{

    private List<InfoBean> data;
    private Context context;

    public MyAdapter(List<InfoBean> _data, Context _context){
        this.data = _data;
        this.context = _context;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
        View view = View.inflate(context, R.layout.recyclerview_item, null);
        return new MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position){
        holder.tv.setText(data.get(position).getName());
    }

    @Override
    public int getItemCount(){
        return data.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder{
        private TextView tv;
        public MyViewHolder(View itemView){
            super(itemView);
            tv = itemView.findViewById(R.id.tv);
        }
    }
}
